<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta charset="utf-8">
        <script language = "JavaScript">		
            function sum(n)	// n是sum函数的参数
            {
                s = 0;
                for (i=1; i<=n; i++)
                {
                    s += i;
                }
                return s;
            }	
        </script>
    </head>
    <body>
        <script language = "JavaScript">        		
            alert("从1加到100得" + sum(100));
        </script>    
    </body>
</html>
